package com.icez.base_compose_framework.util

import androidx.annotation.PluralsRes
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext

/**
 * 资源工具类
 * @author icez
 */
object BResourcesUtil {

    /**
     * 获取对应数量对应的字符串
     * @param id 资源id
     * @param quantity 数量
     */
    @Composable
    public fun quantifyStringResource(@PluralsRes id:Int, quantity:Int):String {
        val context = LocalContext.current
        return context.resources.getQuantityString(id, quantity)
    }

    /**
     * 获取对应数量对应的字符串
     * @param id 资源id
     * @param quantity 数量
     * @param formatArgs 格式化参数
     */
    @Composable
    public fun quantityStringResource(@PluralsRes id:Int, quantity:Int, vararg formatArgs:Any):String {
        val context = LocalContext.current
        return context.resources.getQuantityString(id, quantity, *formatArgs)
    }
}